package week02;
import static java.lang.System.out;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.LineNumberReader;
import java.nio.charset.StandardCharsets;

public class TrafficSumTest {
    public static void main(String[] args) throws IOException {
        File datFile = new File("D:\\Dev\\IdeaProjects\\home-work\\src\\main\\resources\\HTTP_20130313143750.dat");
        LineNumberReader lnr = new LineNumberReader(new FileReader(datFile, StandardCharsets.UTF_8));
        String line = lnr.readLine();
        while (line != null){
            String[] tokenAry = line.split("\t",-1);
            if (tokenAry.length > 10){
                String phoneNumber = tokenAry[1];
                String bytesUp = tokenAry[8];
                String bytesDown = tokenAry[9];
                out.printf("phoneNumber:%s, bytesUp:%s, bytesDown:%s%n",phoneNumber,bytesUp,bytesDown);
            }

            line = lnr.readLine();
        }

        lnr.close();

    }
}
